﻿using System.Drawing;

namespace WindowsApplication2._18_设计模式.基础.继承._2
{
    internal class shape
    {
    }

    public class rectangle
    {
        protected int x, y, w, h;
        protected Pen rpen;

        public rectangle(int x, int y, int w, int h)
        {
            this.x = x;
            this.y = y;
            this.w = w;
            this.h = h;

            rpen = new Pen(Color.Black);
        }

        public virtual void draw(Graphics g)
        {
            g.DrawRectangle(rpen, x, y, w, h);
        }
    }

    public class double_rectangle : rectangle
    {
        public double_rectangle(int x, int y, int w, int h)
            : base(x, y, w, h)
        {
        }

        public override void draw(Graphics g)
        {
            g.DrawRectangle(rpen, x, y, w, h);

            Pen rpen1 = new Pen(Color.Blue, 2);
            g.DrawRectangle(rpen1, x + 5, y + 5, w, h);
        }
    }
}